package com.yunweiweishi.xuhuanpaltform.yuhuan_app.controller;


import com.yunweiweishi.xuhuanpaltform.yuhuan_app.comm.conf.CommonResult;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.pojo.FlightsTask;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.pojo.RemoteGuide;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.RemoteGuideService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Optional;

@Api(value = "远程指导", tags = {"远程指导controller"})
@RestController
@RequestMapping("invitee")
public class RemoteGuideController {




    @Autowired
    private CommonResult result;


    @Autowired
    private RemoteGuideService remoteGuideService;


    /**
     * 通过id进行查找
     */
    @ApiOperation( value = "查询远程指导通过id")
    @GetMapping("/findById/{Id}")
    public CommonResult findById(@PathVariable("Id") Long Id ) {

        try {
            Optional<RemoteGuide> remoteGuide = remoteGuideService.findById(Id);
            result.setData(remoteGuide);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            result.setState(500);
            result.setMsg("失败");
            return result;
        }
    }








    /**
     * 根据专家姓名查询指导列表
     */



    @GetMapping("/findByExpertName/{expertId}")
    public CommonResult findByExpertName(@PathVariable("expertId") Long expertId ) {

        try {
            RemoteGuide remoteGuide = remoteGuideService.findByExpertId(expertId);
            result.setData(remoteGuide);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            result.setState(500);
            result.setMsg("失败");
            return result;
        }
    }

    /**
     *
     * TODO 未完成
     * 点击查看文件 有视频的播放   文件的下载
     */










}
